﻿Public Class fListaMunicipios
    Private lIdMunicipio As String
    Dim daMuni As lbGlobalcom.dsGlobalTableAdapters.GLO_MUNICIPIOSTableAdapter
    Public ReadOnly Property IdMunicipio() As String
        Get
            Return lIdMunicipio
        End Get
    End Property


    Private Sub txtMunicipio_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtMunicipio.TextChanged
        Try
            daMuni.FillByLikeMunicipio(DsGlobal.GLO_MUNICIPIOS, Me.txtMunicipio.Text.ToUpper & "%")
        Catch ex As Exception
            MessageBox.Show(ex.Message)
            lbGlobalcom.cError.SalvaError(ex, "Samuel")
        End Try
    End Sub

    Private Sub fListaMunicipios_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Try
            daMuni = New lbGlobalcom.dsGlobalTableAdapters.GLO_MUNICIPIOSTableAdapter
            Me.txtMunicipio.Focus()
        Catch ex As Exception
            MessageBox.Show(ex.Message)
            lbGlobalcom.cError.SalvaError(ex, "Samuel")
        End Try
    End Sub

    Private Sub lstMunicipios_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles lstMunicipios.KeyDown
        If e.KeyCode = Keys.Enter Then
            If lstMunicipios.SelectedItem IsNot Nothing Then
                lIdMunicipio = lstMunicipios.SelectedValue
                Me.DialogResult = Windows.Forms.DialogResult.OK
            End If
        End If
    End Sub


    Private Sub lstMunicipios_MouseDoubleClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles lstMunicipios.MouseDoubleClick
        If lstMunicipios.SelectedItem IsNot Nothing Then
            lIdMunicipio = lstMunicipios.SelectedValue
            Me.DialogResult = Windows.Forms.DialogResult.OK
        End If
    End Sub

End Class